Support TokenKeg as a known visualizer (instead of Unknown test)#81
Draft
prasanna-anchorage wants to merge 8 commits intomainfrom
Draft
Support TokenKeg as a known visualizer (instead of Unknown test)#81prasanna-anchorage wants to merge 8 commits intomainfrom
prasanna-anchorage wants to merge 8 commits intomainfrom
Conversation
aee64db to
aea8b83
Compare
Add dedicated SPL Token preset to parse and display Token Program instructions (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA) with proper instruction names instead of showing as unknown program. Changes: - Create spl_token preset with full TokenInstruction parsing - Support all token instructions: MintTo, MintToChecked, Transfer, Burn, InitializeMint, etc. with detailed parameter display - Register TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA program ID - Update test_unknown_program_tokenkeg -> test_spl_token_tokenkeg_recognition to verify TokenKeg is recognized as SPL Token, not unknown program - Add assertions to confirm instructions show "Mint To" or "SPL Token" Files: - src/presets/spl_token/mod.rs (new): SplTokenVisualizer implementation - src/presets/spl_token/config.rs (new): Program ID registration - src/presets/mod.rs: Export spl_token module - src/core/visualsign.rs: Update TokenKeg test with SPL Token assertions SPL token minters can now see meaningful instruction details instead of raw hex data. Build system automatically registers SplTokenVisualizer before UnknownProgramVisualizer in the visualizer chain. Co-Authored-By: Claude <noreply@anthropic.com>
Refactors TokenKeg test to verify proper SPL Token recognition and adds dedicated test for unknown program fallback behavior to ensure visualizer chain works correctly. - Rename test_unknown_program_tokenkeg to test_spl_token_tokenkeg_recognition - Add assertion to verify TokenKeg shows "Mint To" or "SPL Token" (not unknown program) - Add test_unknown_program_fallback with FAKEPROGRAM! pattern (ASCII bytes) - Validate UnknownProgramVisualizer correctly handles unsupported programs - Verify program ID and instruction data hex are displayed for unknown programs Co-Authored-By: Claude <noreply@anthropic.com>
Apply cargo fmt and clippy suggestions to resolve warnings. - Reformat import statements in test_unknown_program_fallback (cargo fmt) - Use inline format args in SPL token error messages (clippy::uninlined_format_args) - Use inline format args in instruction name formatting Co-Authored-By: Claude <noreply@anthropic.com>
- Add 5 end-to-end visualization tests verifying full AnnotatedPayloadField
output including addresses, amounts, and field structure
- Fix dead code: Move MintTo/MintToChecked to unreachable!() since they're
handled specially in create_token_preview_layout and never reach
format_token_instruction()
- Coverage improved to 78.26% lines
Co-Authored-By: Claude <noreply@anthropic.com>
aea8b83 to
b36c0c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support TokenKeg (SPL Token) program
Resolves #76
Summary
Adds dedicated visualizer for the TokenKeg program (
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA) to display meaningful SPLtoken instruction details instead of showing as "unknown program". This enables SPL token minters to understand what
operations are being performed in their transactions.
Changes
New SPL Token Preset (
src/presets/spl_token/)TokenInstruction::unpack()fromspl-tokencrateTest Coverage
test_unknown_program_tokenkeg→test_spl_token_tokenkeg_recognitionto verify TokenKeg is properly recognizedas SPL Token
test_unknown_program_fallbackwith fake program ID pattern (FAKEPROGRAM!) to validate unknown program visualizerstill works
Build Integration
presets/mod.rsfor auto-discovery by build.rsUnknownProgramVisualizerin visualizer chainExample Output
Before (Unknown Program):
Program ID: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
Instruction Data: 0601014f42...
After (SPL Token):
Instruction: Mint To
Amount: 1000000
Decimals: 6
Program: SPL Token
Testing